<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<title>指标管理</title>
		<link rel="stylesheet"
			href="#{request.contextPath}/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style>
</style>
	</ui:define>
	<ui:define name="content">
		<div class='full-center-content-scroll-noheader'>
			<div class="row">
				<div style="padding-right: 3px; height: 49px">
					<div class="box box-success" style="height: 49px">
						<div class="box-header with-border" style="padding: 0">
							<h:form id="groupForm">
								<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
									<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes"
										icon="ui-icon-check" />
									<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no"
										icon="ui-icon-close" />
								</p:confirmDialog>
								<p:growl id="msg" showDetail="true"></p:growl>
								<p:toolbar style="padding-left:20px;margin:5px"
									rendered="#{s:hasPermission(session,'gzgl_zbgl_xjzb') or
								s:hasPermission(session,'gzgl_zbgl_bjzb') or
								s:hasPermission(session,'gzgl_zbgl_sczb')}">
									<f:facet name="left">
										<p:commandButton value="新建指标" icon="ui-icon-plus" update=":dialogForm:createDlg"
											rendered="#{s:hasPermission(session,'gzgl_zbgl_xjzb')}"
											actionListener="#{quotaInfoController.preCreate}" oncomplete="PF('createDlg').show()" />
										<p:commandButton value="编辑指标" icon="ui-icon-pencil" id="editGroupBtn"
											rendered="#{s:hasPermission(session,'gzgl_zbgl_bjzb')}"
											disabled="#{quotaInfoController.currentNode == null}" update=":dialogForm:createDlg"
											oncomplete="PF('createDlg').show()" />
										<p:commandButton value="删除指标" icon="ui-icon-trash" id="deleteGroupBtn"
											rendered="#{s:hasPermission(session,'gzgl_zbgl_sczb')}"
											disabled="#{quotaInfoController.currentNode == null}"
											update=":treeForm:tree :infosForm:infosTable" process="@this"
											actionListener="#{quotaInfoController.deleteGroup}">
											<p:confirm header="提示" message="确定要删除该指标么？" icon="ui-icon-alert" />
										</p:commandButton>
									</f:facet>
								</p:toolbar>
							</h:form>
						</div>
						<div class="box-footer"></div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-md-2 full-content" style="padding-right: 3px">
					<div class="box box-success">
						<div class="box-body full-content-scroll">
							<h:form id="treeForm">
								<p:tree id="tree" value="#{quotaInfoController.root}" selectionMode="single" var="node"
									style="border:0">
									<p:ajax event="select"
										update=":infosForm :infosForm:createBtn :groupForm:editGroupBtn :groupForm:deleteGroupBtn"
										listener="#{quotaInfoController.onNodeSelect}" />
									<p:treeNode>
										<h:outputText value="#{node}" />
									</p:treeNode>
								</p:tree>
							</h:form>
						</div>
						<div class="box-footer"></div>
					</div>
				</div>
				<div class="col-md-10 " style="padding-left: 3px">
					<div class="box box-success">
						<div class="box-body full-center-content-scroll-noheader">
							<h:form id="infosForm">
								<p:toolbar style="margin:5px"
									rendered="#{s:hasPermission(session,'gzgl_zbgl_xxnr_xj') or
								s:hasPermission(session,'gzgl_zbgl_xxnr_bj') or
								s:hasPermission(session,'gzgl_zbgl_xxnr_sc')}">
									<f:facet name="left">
										<p:commandButton value="新建" icon="ui-icon-plus" id="createBtn"
											rendered="#{s:hasPermission(session,'gzgl_zbgl_xxnr_xj')}"
											disabled="#{quotaInfoController.currentNode == null}" update=":dialogForm:infoDlg"
											actionListener="#{quotaInfoController.precreateInfo}" oncomplete="PF('infoDlg').show()" />
										<p:commandButton value="编辑" icon="ui-icon-pencil" id="editBtn"
											rendered="#{s:hasPermission(session,'gzgl_zbgl_xxnr_bj')}"
											disabled="#{quotaInfoController.currentInfo.id == null}" update=":dialogForm:infoDlg"
											oncomplete="PF('infoDlg').show()" />
										<p:commandButton value="删除" icon="ui-icon-trash" id="deleteBtn"
											rendered="#{s:hasPermission(session,'gzgl_zbgl_xxnr_sc')}"
											disabled="#{quotaInfoController.currentInfo.id == null}"
											actionListener="#{quotaInfoController.delete}"
											update=":groupForm:msg infosTable :treeForm:tree" />
									</f:facet>
								</p:toolbar>
								<p:dataTable id="infosTable" widgetVar="infosTable" value="#{quotaInfoController.quotas}"
									var="info" selectionMode="single" rowKey="#{info.id}" emptyMessage="无数据">
									<p:ajax event="rowSelect" update="infosForm:editBtn infosForm:deleteBtn"
										listener="#{quotaInfoController.rowSelect}" />
									<p:column headerText="名称" width="25%">
										<p:outputLabel value="#{info.name}" />
									</p:column>
									<p:column headerText="数值" width="25%">
										<p:outputLabel value="#{info.value}" />
									</p:column>
									<p:column headerText="备注">
										<p:outputLabel value="#{info.remark}" />
									</p:column>
								</p:dataTable>
							</h:form>

							<h:form id="dialogForm">
								<p:dialog widgetVar="createDlg" header="指标名称" modal="true" id="createDlg" width="300"
									height="160">
									<p:toolbar>
										<f:facet name="left">
											<p:commandButton value="保存" icon="ui-icon-disk" update=":treeForm:tree"
												actionListener="#{quotaInfoController.save}" oncomplete="PF('createDlg').hide()" />
											<p:commandButton value="取消" icon="ui-icon-cancel" oncomplete="PF('createDlg').hide()" />
										</f:facet>
									</p:toolbar>
									<p:panelGrid style="margin-top:10px">
										<p:outputLabel value="指标名称" />
										<p:inputText value="#{quotaInfoController.currentGroup.groupName}"
											style="margin-left:10px" />
									</p:panelGrid>
								</p:dialog>

								<p:dialog widgetVar="infoDlg" header="指标" modal="true" id="infoDlg" width="300" height="300">
									<p:toolbar>
										<f:facet name="left">
											<p:commandButton value="保存" icon="ui-icon-disk" update=":infosForm:infosTable"
												actionListener="#{quotaInfoController.saveInfo}" oncomplete="PF('infoDlg').hide()" />
											<p:commandButton value="取消" icon="ui-icon-cancel" oncomplete="PF('infoDlg').hide()" />
										</f:facet>
									</p:toolbar>
									<p:panelGrid columns="2" style="margin-top:10px">
										<p:outputLabel value="名称" />
										<p:inputText value="#{quotaInfoController.currentInfo.name}" />
										<p:outputLabel value="指标" />
										<p:inputText value="#{quotaInfoController.currentInfo.value}" />
										<p:outputLabel value="备注" />
										<p:inputTextarea value="#{quotaInfoController.currentInfo.remark}" />
									</p:panelGrid>
								</p:dialog>
							</h:form>
						</div>
						<div class="box-footer"></div>
					</div>
				</div>
			</div>
			<div id="pop" class="modal">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-label="Close">
								<span aria-hidden="false">x</span>
							</button>
							<h4 id="popTitle" class="modal-title"></h4>
						</div>
						<div class="modal-body" style="height: 500px">
							<div id="popBody" class="col-sm-12">
								<div id="popChart" style="height: 450px"></div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</ui:define>

	<ui:define name="contentend">
	</ui:define>
</ui:composition>
